package com.gxa.uhome.service.impl;

import com.gxa.uhome.mapper.AdminMapper;
import com.gxa.uhome.mapper.TbAdminMapper;
import com.gxa.uhome.pojo.Admin;

import com.gxa.uhome.service.AdminService;

import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author: qingyao
 * @date: 9:25 2021/6/9
 */
@Service("AdminService")
public class AdminServiceImpl implements AdminService {
    @Resource
    private AdminMapper adminMapper;

    @Override
    public List<Admin> getall(Integer page, Integer size) {
        return adminMapper.getall(page, size);
    }

    @Override
    public List<Admin> select(String role, String name, Integer page, Integer size) {
        return adminMapper.select(role, name, (page-1)*size, size);
    }

    @Override
    public Integer resetpwd(Integer id) {
        return adminMapper.resetpwd(id);
    }

    @Override
    public Integer insert(Admin admin) {
            Integer insert = adminMapper.insert(admin);
            adminMapper.insertadd();
            return insert;
    }

    @Override
    public Integer update(Admin admin) {
                Integer update = adminMapper.update(admin);
                return update;
    }

    @Override
    public Integer delete(Integer[] id) {
        return adminMapper.delete(id);
    }

    @Override
    public Admin login(Admin admin) {
        return adminMapper.login(admin);
    }

    @Override
    public Integer changepwd(Admin admin) {
        return adminMapper.changepwd(admin);
    }

    @Override
    public Admin selectAdminAndMenuById(Integer id) {
        return adminMapper.selectAdminAndMenuById(id);
    }

/*    @Override
    public Admin selectById(Integer id) {
        return adminMapper.selectById(id);
    }*/
}
